package com.googlecode.horncomb.web.extremetable.custom;

import org.extremecomponents.table.core.TableModel;
import org.extremecomponents.table.view.AbstractHtmlView;
import org.extremecomponents.util.HtmlBuilder;

public class SimpleLinkView extends AbstractHtmlView
{
    @Override
	protected void beforeBodyInternal(TableModel model)
    {
        toolbar(getHtmlBuilder(), getTableModel());

        getTableBuilder().tableStart();

        getTableBuilder().theadStart();
        
        getTableBuilder().titleRowSpanColumns();
        
        getTableBuilder().filterRow();

        getTableBuilder().headerRow();

        getTableBuilder().theadEnd();

        getTableBuilder().tbodyStart();
    }

    @Override
	protected void afterBodyInternal(TableModel model)
    {
        getCalcBuilder().defaultCalcLayout();

        getTableBuilder().tbodyEnd();
        
//        getHtmlBuilder().newline().tabs(1).append("<tfoot>");
//        toolbar(getHtmlBuilder(), getTableModel());
//        getHtmlBuilder().newline().tabs(1).append("</tfoot>");
        
        getTableBuilder().tableEnd();
    }

    protected void toolbar(HtmlBuilder html, TableModel model)
    {
        new LinkToolbar(html, model).layout();
    }
}
